import { RouteRecordRaw } from "vue-router";
import HomeView from "@/views/HomeView.vue";
import NoAuth from "@/views/NoAuth.vue";
import UserLayout from "@/layout/UserLayout.vue";
import UserLoginPage from "@/views/user/UserLoginPage.vue";
import UserRegisterPage from "@/views/user/UserRegisterPage.vue";
import UserPage from "@/views/user/UserPage.vue";
import MyAppPage from "@/views/user/MyAppPage.vue";
import AdminUserPage from "@/views/admin/AdminUserPage.vue";
import AdminAnswerPage from "@/views/admin/AdminAnswerPage.vue";
import AdminAppPage from "@/views/admin/AdminAppPage.vue";
import AdminQuestionPage from "@/views/admin/AdminQuestionPage.vue";
import AdminScoringPage from "@/views/admin/AdminScoringPage.vue";
import AppDetailPage from "@/views/app/AppDetailPage.vue";
import AppAddPage from "@/views/add/AppAddPage.vue";
import QuestionAddPage from "@/views/add/QuestionAddPage.vue";
import ScoringResultAddPage from "@/views/add/ScoringResultAddPage.vue";
import UserAnswerAddPage from "@/views/add/UserAnswerAddPage.vue";
import AnswerResultPage from "@/views/answer/AnswerResultPage.vue";
import doQuestionPage from "@/views/answer/DoQuestionPage.vue";
import MyAnswerPage from "@/views/answer/MyAnswerPage.vue";
import AppStatisticPage from "@/views/statistic/AppStatisticPage.vue";
import ACCESS_ENUM from "@/access/accsessEnum";

export const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "主页",
    component: HomeView,
  },
  {
    path: "/noAuth",
    name: "noAuth",
    component: NoAuth,
    meta: {
      hideMenu: true, //表示该页面中不显示导航栏
    },
  },

  {
    path: "/admin/user",
    name: "用户管理",
    component: AdminUserPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },

  {
    path: "/admin/app",
    name: "应用管理",
    component: AdminAppPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/admin/question",
    name: "题目管理",
    component: AdminQuestionPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },

  {
    path: "/admin/scoring",
    name: "评分管理",
    component: AdminScoringPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },

  {
    path: "/admin/answer",
    name: "回答管理",
    component: AdminAnswerPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },

  {
    path: "/app_statistic",
    name: "应用统计",
    component: AppStatisticPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },

  {
    path: "/app/detail/:id",
    name: "应用详情页",
    props: true,
    component: AppDetailPage,
    meta: {
      hideMenu: true,
    },
  },

  {
    path: "/app/add/:id",
    name: "应用修改页",
    props: true,
    component: AppAddPage,
    meta: {
      hideMenu: true,
    },
  },

  {
    path: "/app/add/",
    name: "应用创建页",
    component: AppAddPage,
  },

  {
    path: "/question/add/:appId",
    name: "题目创建页",
    props: true,
    component: QuestionAddPage,
    meta: {
      hideMenu: true,
    },
  },

  {
    path: "/scoring/add/:appId",
    name: "得分创建页",
    props: true,
    component: ScoringResultAddPage,
    meta: {
      hideMenu: true,
    },
  },

  {
    path: "/answer/do/:appId",
    name: "答题页",
    props: true,
    component: doQuestionPage,
    meta: {
      hideMenu: true,
      access: ACCESS_ENUM.USER,
    },
  },

  {
    path: "/answer/result/:id",
    name: " 查看结果页",
    props: true,
    component: AnswerResultPage,
    meta: {
      hideMenu: true,
      access: ACCESS_ENUM.USER,
    },
  },

  {
    path: "/answer/my/",
    name: " 我的答题记录",
    props: true,
    component: MyAnswerPage,
    meta: {
      access: ACCESS_ENUM.USER,
    },
  },

  {
    path: "/hide",
    name: "隐藏页面",
    component: HomeView,
    meta: {
      hideMenu: true, //表示该页面中不显示导航栏
    },
  },

  {
    path: "/my/detail",
    name: "用户中心",
    component: UserPage,
    meta: {
      access: ACCESS_ENUM.USER,
      hideMenu: true,
    },
  },

  {
    path: "/my/app",
    name: "我的应用",
    component: MyAppPage,
    meta: {
      access: ACCESS_ENUM.USER,
    },
  },

  {
    path: "/user",
    name: "用户",
    // component: UserLayout,
    children: [
      {
        path: "/user/login",
        name: "用户登录",
        component: UserLoginPage,
      },
      {
        path: "/user/register",
        name: "用户注册",
        component: UserRegisterPage,
      },
    ],
    meta: {
      hideMenu: true, //表示该页面中不显示导航栏
    },
  },
];
